package com.lanou3g.HW_0521.view;

import com.lanou3g.HW_0521.util.VerifyCode;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/5/19;
 * Otherwise, I don't know who created it either
 */

@WebServlet(name = "tmp", urlPatterns = "/tmp")
public class TmpServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ServletOutputStream outputStream = resp.getOutputStream();
        VerifyCode code = new VerifyCode();
        BufferedImage image = code.getImage();
        code.out(image, outputStream);
        String text = code.getText();
    }
}
